package com.sora.test;

import com.sora.api.ByeService;
import com.sora.api.HelloObject;
import com.sora.api.HelloService;
import com.sora.serializer.CommonSerializer;
import com.sora.transport.RpcClientProxy;
import com.sora.serializer.KryoSerializer;
import com.sora.transport.socket.client.SocketClient;

/**
 * @Classname: TestClient
 * @Description:
 * @Author: Stonffe
 * @Date: 2023/4/30 11:25
 */
public class SocketTestClient {
    public static void main(String[] args) {
        SocketClient client = new SocketClient(CommonSerializer.KRYO_SERIALIZER);
        RpcClientProxy proxy = new RpcClientProxy(client);
        HelloService service = proxy.getProxy(HelloService.class);
        HelloObject object = new HelloObject(12, "this is a message");
        String res = service.hello(object);
        System.out.println(res);
        ByeService byeService = proxy.getProxy(ByeService.class);
        System.out.println(byeService.bye("socket"));
    }
}
